#include "background.h"

// return H(a) as a function of scale factor a in unit of km/s/Mpc
double H_a( double a, void *p ){
    cosmo_params *cp = (cosmo_params*)p;
    double H0 = cp->h*100.0;
    double Om = cp->Omega_b + cp->Omega_c;
    double Ol = cp->Omega_L;
    double Or = cp->Omega_r;

    double O_sum = Om/pow(a,3) + Ol + Or/pow(a,4);

    return H0*sqrt(O_sum);
}


double H_z( double z, void *p ){
    double a = 1./(1.+z);
    return H_a(a,p);
}
